<?
include("includes/config.inc.php");
include("includes/auth.lib.php");
include("FCKeditor/fckeditor.php");
$module="CONFIGURAZIONE";
$menusx = "&nbsp;";
   list($status, $user) = auth_get_status();
   switch($status){
       case AUTH_LOGGED:
        $result1 = @mysql_query("SELECT nome,stato FROM utenti WHERE id='$id_user';");
        list($username,$level) = mysql_fetch_row($result1);
	            //recupero i dati in post
               $op = $_GET['op'];
               if(!isset($op) && $op=="")
                 $op = $_POST['op'];
			   $menusx = "<table width=200 cellpadding=3>
			   				<tr>
							  <td valign=middle width=30 height=30><a class=menusx href=\"config.php?op=mail\"><img src=\"imgs/feedback.gif\" width=30 height=30 alt=\"Feedback\" border=0></a></td><td align=left valign=middle><a class=menusx href=\"config.php?op=mail\">Gestione Mail Automatiche</a></td>
							</tr>
							<tr>
							  <td valign=middle width=30 height=30><a class=menusx href=gestione.php><img src=\"imgs/ico_back.gif\" width=30 height=30 alt=Principale border=0></a></td><td align=left valign=middle><a class=menusx href=gestione.php>Torna alla pagina principale</a></td>
							</tr>
						</table>";

			   switch($op)  {
			     case "update":
				   $content = printError($newTariffe->update($_POST));
				 break;

			     case "update_banner":
				   $content = printError($newBanner->update($_POST));
				 break;
				 
			     case "mail":
			     	$content = '<table width=100% cellpadding=3 cellspacing=0 class=content border="1 solid #COCOCO">
				   			<form name="formconfig2" action="config.php" method="POST" enctype="multipart/form-data">
				   	<tr>
					 <td align="center" class=tbtit><b>Configurazione Mail Automatiche</b></td>
					</tr>
					<tr>
					 <td align="center"><b>Mail notifica chiusura ordine - Pagamento con Bonifico:</b><br>';
					 $oFCKeditor = new FCKeditor('mail_ordine_bonifico');
					 $oFCKeditor->Value = $_CONFIG['mail_ordine_bonifico'];
					 $content .= $oFCKeditor->Create(); 
					 $content .= '</td>
					</tr>
					<tr>
					 <td align="center"><b>Mail notifica chiusura ordine - Pagamento con Poste Pay:</b><br>';
					 $oFCKeditor = new FCKeditor('mail_ordine_postepay');
					 $oFCKeditor->Value = $_CONFIG['mail_ordine_postepay'];
					 $content .= $oFCKeditor->Create(); 
					 $content .= '</td>
					</tr>
					<tr>
					 <td align="center"><b>Mail notifica chiusura ordine - Pagamento in Contrassegno:</b><br>';
					 $oFCKeditor = new FCKeditor('mail_ordine_contrassegno');
					 $oFCKeditor->Value = $_CONFIG['mail_ordine_contrassegno'];
					 $content .= $oFCKeditor->Create(); 
					 $content .= '</td>
					</tr>
					<tr>
					 <td align="center"><b>Mail notifica pagamento non avvenuto:</b><br>';
					 $oFCKeditor = new FCKeditor('mail_notifica');
					 $oFCKeditor->Value = $_CONFIG['mail_notifica'];
					 $content .= $oFCKeditor->Create(); 
					 $content .= '</td>
					</tr>
					<tr>
					 <td align="center"><b>Mail notifica pagamento avvenuto:</b><br>';
					 $oFCKeditor = new FCKeditor('mail_pagato');
					 $oFCKeditor->Value = $_CONFIG['mail_pagato'];
					 $content .= $oFCKeditor->Create(); 
					 $content .= '</td>
					</tr>
					<tr>
					 <td align="center"><b>Mail notifica ordine spedito:</b><br>';
					 $oFCKeditor = new FCKeditor('mail_spedito');
					 $oFCKeditor->Value = $_CONFIG['mail_spedito'];
					 $content .= $oFCKeditor->Create(); 
					 $content .= '</td>
					</tr>
					<tr>
					  <td align=center>
					   <input type="hidden" name="op" value="update_mail" />
                   	   <input type="image" src="imgs/ico_save.gif" title="Salva modifiche"> - <a href="javascript:document.formconfig2.submit();">Salva modifiche</a></td>
					</tr>				  
				 </form>
				</table>';
			     break;
			     
			     case "update_mail":
				   $content = printError($newBanner->update($_POST));
				 break;
				 
				 default:
				$content = "<table width=100% cellpadding=3 cellspacing=0 class=content border=\"1 solid #COCOCO\">
				   			<form name=\"formconfig2\" action=\"config.php\" method=\"POST\" enctype=\"multipart/form-data\">
				   	<tr>
					 <td align=\"center\" class=tbtit colspan=2><b>Configurazione Banner</b></td>
					</tr>
					<tr>
					 <td align=right width=300><b>Larghezza Banner in alto:</b></td><td><input type=\"text\" name=\"alto_width\" size=10 value=\"".$_CONFIG['alto_width']."\"/>&nbsp;px.</td>
				   </tr>
					<tr>
					 <td align=right width=300><b>Altezza Banner in alto:</b></td><td><input type=\"text\" name=\"alto_height\" size=10  value=\"".$_CONFIG['alto_height']."\"/>&nbsp;px.</td>
				   </tr>
					<tr>
					 <td align=right width=300><b>Larghezza Banner a destra:</b></td><td><input type=\"text\" name=\"destra_width\" size=10 value=\"".$_CONFIG['destra_width']."\"/>&nbsp;px.</td>
				   </tr>
					<tr>
					 <td align=right width=300><b>Altezza Banner a destra:</b></td><td><input type=\"text\" name=\"destra_height\" size=10  value=\"".$_CONFIG['destra_height']."\"/>&nbsp;px.</td>
				   </tr>
					<tr>
					 <td align=right width=300><b>Larghezza Banner in basso:</b></td><td><input type=\"text\" name=\"basso_width\" size=10 value=\"".$_CONFIG['basso_width']."\"/>&nbsp;px.</td>
				   </tr>
					<tr>
					 <td align=right width=300><b>Altezza Banner in basso:</b></td><td><input type=\"text\" name=\"basso_height\" size=10  value=\"".$_CONFIG['basso_height']."\"/>&nbsp;px.</td>
				   </tr>
					<tr>
					 <td align=right width=300><b>Larghezza Banner a sinistra:</b></td><td><input type=\"text\" name=\"sinistra_width\" size=10 value=\"".$_CONFIG['sinistra_width']."\"/>&nbsp;px.</td>
				   </tr>
					<tr>
					 <td align=right width=300><b>Altezza Banner a sinistra:</b></td><td><input type=\"text\" name=\"sinistra_height\" size=10  value=\"".$_CONFIG['sinistra_height']."\"/>&nbsp;px.</td>
				   </tr>
					<tr>
					 <td align=right width=300><b>Numero di Banner colonna destra:</b></td><td><input type=\"text\" name=\"num_destra\" size=10 value=\"".$_CONFIG['num_destra']."\"/>&nbsp;px.</td>
				   </tr>
					<tr>
					 <td align=right width=300><b>Numero di Banner colonna sinistra:</b></td><td><input type=\"text\" name=\"num_sinistra\" size=10  value=\"".$_CONFIG['num_sinistra']."\"/>&nbsp;px.</td>
				   </tr>
					<tr>
					  <td align=center colspan=2>
					   <input type=\"hidden\" name=\"op\" value=\"update_banner\" />
                   	   <input type=\"image\" src=\"imgs/ico_save.gif\" title=\"Salva modifiche\"> - <a href=\"javascript:document.formconfig2.submit();\">Salva modifiche</a></td>
					</tr>				  
					   </form>
				</table>";
				 break;
			   }
       break;

       case AUTH_NOT_LOGGED:
        header("Location:index.html");
       break;
}
?>
<html><!-- InstanceBegin template="/Templates/moduli.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<!-- InstanceBeginEditable name="doctitle" -->
<title>Configurazione</title>
<!-- InstanceEndEditable -->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
<link href="style/style.css" rel="stylesheet" type="text/css">
<script type="text/JavaScript">
<!--
<?=$javascript?>

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  var dis;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) {
	   obj=obj.style; 
	   if(v == 'show')  {
	     v = 'visible';
		 dis = 'block';
	   }
	   if(v == 'hide')  {
	     v = 'hidden';
		 dis = 'none';	 
	   }
	 }  
    obj.visibility = v; 
	obj.display = dis;
	}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="MM_preloadImages('imgs/icons/pag_web-b.gif','imgs/icons/info_utente-b.gif','imgs/icons/prodotti-b.gif','imgs/icons/newsletter-b.gif','imgs/icons/news-b.gif','imgs/icons/gest_banner-b.gif','imgs/icons/utenti-b.gif','imgs/icons/configurazione-b.gif','imgs/icons/kw-b.gif'); <?=$onload?>">
<!-- ImageReady Slices (gestione.psd - Slices: 02, 03, 04, 06, 07, 08, 09, 10, 11, 12) -->
<!-- End ImageReady Slices -->
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="40" height="177" background="imgs/bkgSx.gif">&nbsp;</td>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="552" background="imgs/gestione_02.gif"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="360"><img src="imgs/spacer20.gif" width="360" height="73"></td>
            <td><table width="100%" height="73" border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td height="5"><img src="imgs/spacer20.gif" width="45" height="5"></td>
              </tr>
              <tr>
                <td align="left" valign="middle" class="tit01"><!-- InstanceBeginEditable name="user" --><?=$username?><!-- InstanceEndEditable --></td>
              </tr>
            </table></td>
          </tr>
        </table></td>
        <td background="imgs/gestione_03.gif">&nbsp;</td>
        <td width="221"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td><img src="imgs/gestione_04.gif" width="221" height="17" alt=""></td>
          </tr>
          <tr>
            <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="57"><a href="gestione.php?logout=1"><img src="imgs/gestione_06.gif" alt="Logout" width="57" height="51" border="0"></a></td>
                <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td><a href="mailto:info@media-tek.it"><img src="imgs/gestione_07.gif" alt="" width="164" height="25" border="0"></a></td>
                  </tr>
                  <tr>
                    <td><a href="#"><img src="imgs/gestione_08.gif" alt="" width="164" height="26" border="0"></a></td>
                  </tr>
                </table></td>
              </tr>
            </table></td>
          </tr>
          <tr>
            <td><img src="imgs/gestione_09.gif" width="221" height="5" alt=""></td>
          </tr>
        </table></td>
      </tr>
    </table>
      <table width="100%" height="104" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td width="678" background="imgs/gestione_10.gif"><table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="203"><table width="203" height="104" border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td><img src="imgs/spacer20.gif" width="203" height="65"></td>
                </tr>
                <tr>
                  <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td width="45"><img src="imgs/spacer20.gif" width="45" height="39"></td>
                      <td><table width="100%" height="39" border="0" cellpadding="5" cellspacing="0">
                        <tr>
                          <td align="left" valign="middle" class="module"><!-- InstanceBeginEditable name="module" --><?=$module?><!-- InstanceEndEditable --></td>
                        </tr>
                      </table></td>
                    </tr>
                  </table></td>
                </tr>
              </table></td>
              <td><table width="475" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td width="50"><img src="imgs/spacer20.gif" width="50" height="104" alt=""></td>
                  <td align="left" valign="bottom">
				  <? if($level!="VBL")  { ?>
				  <table border="0" cellspacing="0" cellpadding="2"><tr><?
	if($level=="admin")  {
?><td width="58"><a href="gestione.php?module=config" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('config','','imgs/icons/configurazione-b.gif',1)"><img src="imgs/icons/configurazione.gif" alt="Configurazione applicazioni" name="config" width="58" height="69" border="0"></a></td><?
	}
	if($level=="admin")  {
?><td width="58"><a href="gestione.php?module=content" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('pages','','imgs/icons/pag_web-b.gif',1)"><img src="imgs/icons/pag_web.gif" alt="Pagine web" name="pages" width="58" height="69" border="0"></a></td><td width="58"><a href="gestione.php?module=newsletter" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Newsletter','','imgs/icons/newsletter-b.gif',1)"><img src="imgs/icons/newsletter.gif" alt="Newsletter" name="Newsletter" width="58" height="69" border="0"></a></td><?
	}
?>
<td width="58"><a href="gestione.php?module=news" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('News','','imgs/icons/news-b.gif',1)"><img src="imgs/icons/news.gif" alt="News" name="News" width="58" height="69" border="0"></a></td><?
	if($level=="admin")  {
?><td width="58"><a href="gestione.php?module=banner" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('banner','','imgs/icons/gest_banner-b.gif',1)"><img src="imgs/icons/gest_banner.gif" alt="Gestione Banner" name="banner" width="58" height="69" border="0"></a></td><?
	}
?><td width="58"><a href="gestione.php?module=prodotti"><img src="imgs/icons/prodotti.gif" alt="Pagine Web" name="pagine" width="58" height="69" border="0" id="pagine" onMouseOver="MM_swapImage('pagine','','imgs/icons/prodotti-b.gif',1)" onMouseOut="MM_swapImgRestore()"></a></td>
</tr></table>
<? } ?>
</td>
				</tr>
              </table></td>
            </tr>
          </table></td>
          <td valign="bottom" background="imgs/gestione_11.gif"><?
	if($level=="admin")  {
?><table cellpadding="2" cellspacing="0">
		    <tr>
			  <td width="58"><a href="gestione.php?module=keywords" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('keywords','','imgs/icons/kw-b.gif',1)"><img src="imgs/icons/kw.gif" alt="Gestione Keywords" name="keywords" width="58" height="69" border="0"></a></td>
			  <td width="58"><a href="gestione.php?module=webuser" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('webutente','','imgs/icons/utenti-b.gif',1)"><img src="imgs/icons/utenti.gif" name="webutente" width="58" height="69" border="0"></a></td>
			  <td width="58"><a href="gestione.php?module=user" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Utente','','imgs/icons/info_utente-b.gif',1)"><img src="imgs/icons/info_utente.gif" name="Utente" width="58" height="69" border="0"></a></td>
			  <td width="20" valign="middle">
				<table width="22" cellpadding="0" cellspacing="0">
				<tr>
				 <td width="22">
				  <a href="gestione.php?module=change_lang&newlang=eng"><img src="imgs/icons/ico-eng.jpg" alt="Inglese" width="20" height="20" border="0"></a></td>
				</tr>
				<tr>
				<td class="error" width="22" align="center" valign="middle"><a href="gestione.php?module=change_lang&newlang=ita"><img src="imgs/icons/ico-ita.jpg" alt="Italiano" width="20" height="20" border="0"></a></td>
				</tr>
			   </table>
			   </td>			  
			</tr>
		   </table><?
		   } else {
?>&nbsp;<?
}
		   ?></td>
          <td width="95"><img src="imgs/gestione_12.gif" width="95" height="104" alt=""></td>
        </tr>
      </table>
    </td>
    <td width="40" background="imgs/bkgDx.gif">&nbsp;</td>
  </tr>
  <tr>
    <td background="imgs/bkgSx.gif">&nbsp;</td>
    <td valign="top" bgcolor="#F6F6F6"><table width="100%" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td width="203" align="left" valign="top" bgcolor="#DFDFDF" class="menusx"><!-- InstanceBeginEditable name="menuSx" --><?=$menusx?><!-- InstanceEndEditable --></td>
        <td align="left" valign="top" bgcolor="#EFEFEF" class="content"><!-- InstanceBeginEditable name="content" --><?=$content?><!-- InstanceEndEditable --></td>
      </tr>
    </table>
      <table width="100%" height="50" border="0" cellpadding="5" cellspacing="0">
        <tr>
          <td background="imgs/gestione_03.gif" bgcolor="#F6F6F6" class="copy"><p>2006&copy; Gestione moduli dinamici - release 1.2 - Powered by Media-tek </p></td>
        </tr>
      </table></td>
    <td background="imgs/bkgDx.gif">&nbsp;</td>
  </tr>
</table>
</body>
<!-- InstanceEnd --></html>